package org.tema.ejb;

import javax.ejb.*;
import org.tema.entities.User;
import org.tema.entities.Product;
import org.tema.entities.UserGroup;

import java.security.NoSuchAlgorithmException;
import java.util.*;

@Local
public interface UserBeanLocal {
	
	public  String encryptPassword(String password) throws NoSuchAlgorithmException;
	public User addUser( String name, boolean isAdmin, String password, Product product);
	public User updateUser(User user);
	public User undoUserChanges(User user);
	public void deleteUser(User user);
	public Collection <User> findAllUsers();
	public Collection <User> findUsersByName( String name );
	
	//search methods
	public User  findUserById( int id );
	public User findUserByName( String name );
//	public User findUserByPrivilige( Boolean isAdmin );

	//for the searches of products where the users participates in, 
	//test cases, test plans and test design specifications he/she has created
	//use the getter/setter methods of the User class for the respective DB relationships.

	public Collection <User>  findUserByProductId( int productId );// all testers working on that product
	public Collection <User>  findUserByProductName( String prodName );
	
	//user group methods
	
	public UserGroup createUserGroup(String name, String description);
	public void addUserToGroup( User user, UserGroup  userGroup );
	public Collection <UserGroup>  findUserGroup( String userName );
	public Collection <User> findUsersInGroup( String groupName );
	public UserGroup findUserGroupByName(String groupName);
	public Collection <String> findAllGroups();
	public Collection <UserGroup> getAllGroups();
	

	

}
